#ifdef GL_FRAGMENT_PRECISION_HIGH
	precision highp float;
#else
	precision mediump float;
#endif

uniform vec3 lightDir;
uniform vec3 lightAmbient;
uniform vec3 lightDiffuse;

varying vec4 color;
varying vec3 normal;

void main()
{

	// compute diffuse term
	vec3 	n 				= normalize(normal);
	float	kd				= max(0.0, dot(n, lightDir));
	
	// compute components of lighting equation
	lowp vec3 ca			= lightAmbient * color.rgb;
	lowp vec3 cd			= lightDiffuse * kd * color.rgb;
	
	// compute final color
	gl_FragColor = vec4( cd + ca, color.a );

}